package com.dykj.fireFighting.server.socialUnit.devicemanger.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.dykj.fireFighting.api.socialUnit.devicemanger.dto.DeviceInfoDto;
import com.dykj.fireFighting.api.socialUnit.devicemanger.entity.DeviceInfo;
import com.dykj.fireFighting.api.socialUnit.devicemanger.service.IDeviceInfoService;
import com.dykj.fireFighting.api.socialUnit.xfxg.vo.FireGroupVo;
import com.dykj.fireFighting.common.core.service.impl.BaseServiceImpl;
import com.dykj.fireFighting.common.core.vo.PageVo;
import com.dykj.fireFighting.server.socialUnit.devicemanger.mapper.DeviceInfoMapper;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.transaction.annotation.Transactional;


import java.util.List;
import java.util.Map;

/**
 * VIEW
 *
 * @Author JacksonTu
 * @Date  2021-06-29 13:26:48
 */
@Slf4j
@DubboService
@Transactional(rollbackFor = Exception.class)
public class DeviceInfoServiceImpl extends BaseServiceImpl<DeviceInfoMapper, DeviceInfo> implements IDeviceInfoService {
    @Override
   public PageVo<DeviceInfo> pageListFireStation(DeviceInfoDto commonDto){
        Page page = new Page();
        // 设置当前页码
        page.setCurrent(commonDto.getPage());
        // 设置页大小
        page.setSize(commonDto.getLimit());
        IPage iPage= baseMapper.pageListFireStation(page,commonDto);
        return new PageVo(iPage);
   }

    @Override
    public PageVo<DeviceInfo> pageListHazardSources(DeviceInfoDto commonDto){
        Page page = new Page();
        // 设置当前页码
        page.setCurrent(commonDto.getPage());
        // 设置页大小
        page.setSize(commonDto.getLimit());
        IPage iPage= baseMapper.pageListHazardSources(page,commonDto);
        return new PageVo(iPage);
    }

    @Override
    public PageVo<DeviceInfo> pageListKeyParts(DeviceInfoDto commonDto){
        Page page = new Page();
        // 设置当前页码
        page.setCurrent(commonDto.getPage());
        // 设置页大小
        page.setSize(commonDto.getLimit());
        IPage iPage= baseMapper.pageListKeyParts(page,commonDto);
        return new PageVo(iPage);
    }

    @Override
    public FireGroupVo getDeviceByGroupId(String groupId) {
        FireGroupVo deviceByGroupId = baseMapper.getDeviceByGroupId(groupId);
        return deviceByGroupId;
    }
}
